Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::KeyRepeatGenerator Class Reference

The KeyRepeatGenerator is an event source decorator that scans the event queue of the EventSource it extends for key-press events and generates from them key-press repetitions. More...

#include <kanzi/core.ui/input/key_repeat_generator.hpp>

Inheritance diagram for kanzi::KeyRepeatGenerator:
[legend]

Public Member Functions

void gatherEvents (EventQueue &queue) override
 Overrides EventSource::gatherEvents(). More...
 
optional< NativeEventHandlegetNativeEventHandle () const noexcept override
 Overrides EventSource::getNativeEventHandle(). More...
 
EventSourceSharedPtr getWrappedEventSource () const override
 Overrides EventSourceDecorator::getWrappedEventSource(). More...
 
bool hasQueuedEvents () const
 Checks whether the key repeat decorator has events that were not yet dispatched. More...
 
 KeyRepeatGenerator (Domain *domain, EventSourceSharedPtr eventSource)
 Constructor. More...
 
 ~KeyRepeatGenerator () override
 Destructor. More...
 
- Public Member Functions inherited from kanzi::EventSource
virtual ~EventSource ()=default
 Destructor. More...
 
- Public Member Functions inherited from kanzi::EventSourceDecorator
virtual ~EventSourceDecorator ()=default
 Destructor. More...
 

Detailed Description

The KeyRepeatGenerator is an event source decorator that scans the event queue of the EventSource it extends for key-press events and generates from them key-press repetitions.

You can use this in combination with other event source decorators, and event sources that are not capable of providing key-press repetitions to an Application. When combined with KeyMapEventFilter, it is recommended to use the KeyRepeatGenerator as the event source for the KeyMapEventFilter.

The key-press repetition algorithm works as follows:

  • When a key-press event consists of only a modifier key, Kanzi does not repeat that key-press event but instead adds it to the already repeated key-press event as a modifier key.
  • The last-pressed key replaces a previously repeated key-press event and resets the key repetition timers.
  • Kanzi emits the first key-press repetition after the timeout specified by kanzi::c_keyRepeatDelay, after which the subsequent key-press repetitions occur at the rate specified by kanzi::c_keyRepeatInterval.
  • A key-release event stops the key-press repetitions only when the released key is not a modifier key. When a modifier key is released, Kanzi removes that modifier key from the repeated key-press event and continues to repeat the key-press event with the remaining modifier keys.
See also
Application, EventSource, EventSourceDecorator
Since
Kanzi 3.9.0

Constructor & Destructor Documentation

kanzi::KeyRepeatGenerator::KeyRepeatGenerator ( Domain domain,
EventSourceSharedPtr  eventSource 
)
explicit

Constructor.

kanzi::KeyRepeatGenerator::~KeyRepeatGenerator ( )
override

Destructor.

Member Function Documentation

void kanzi::KeyRepeatGenerator::gatherEvents ( EventQueue queue)
overridevirtual
optional<NativeEventHandle> kanzi::KeyRepeatGenerator::getNativeEventHandle ( ) const
inlineoverridevirtualnoexcept
bool kanzi::KeyRepeatGenerator::hasQueuedEvents ( ) const

Checks whether the key repeat decorator has events that were not yet dispatched.

Returns
If the key repeat decorator has unprocessed events, returns true, otherwise false.
EventSourceSharedPtr kanzi::KeyRepeatGenerator::getWrappedEventSource ( ) const
inlineoverridevirtual

The documentation for this class was generated from the following file: